<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
<title>收入明细</title>
<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
<link rel="stylesheet" type="text/css" href="../../css/common.css" />
<style>
body{
	background: #F5F7F8 !important;
}
.aui-tab .aui-tab-item {
	color: #ADADAD;
}
.aui-tab .aui-tab-item.aui-active:before {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 0;
	background: #E63350;
	height: 0.1rem;
	width: 43%;
	-webkit-transform: translateX(-50%);
	transform: translateX(-50%);
}
#item-tab{
	padding-right: 0.7rem;
	margin-bottom:0.2rem;
}
#item-tab .aui-tab-item.active{
	color: #333;
	font-weight: bold;
}
.info-list{
	height: 3.2rem;
	background: #fff;
	padding: 0 0.8rem;
}
.border-b{
	border-bottom: 1px solid #E7E7E7;

}
.head{
	height: 2rem;
	width: 2rem;
	margin-right: 0.4rem;
}
/*.imgH{
	height: 0.6rem;
	margin-left: 0.3rem;
	vertical-align: -3px;
}*/
.log {
	width: 5rem;
	/*display: inline-block;*/
	/*margin-left: 0.3rem;*/
}

.log.tag-pt {
	/*background: url('../../image/mine/m_icon23.png') no-repeat center;
	background-size: auto 0.6rem;*/
}

.log.tag-vip {
	/*background: url('../../image/mine/m_icon22.png') no-repeat center;
	background-size: auto 0.6rem;*/
}

.log.tag-y {
	/*background: url('../../image/mine/m_icon24.png') no-repeat center;
	background-size: auto 0.6rem;*/
}
.black{
	height: 2.5rem;
}
.bt{
	background-color: white;
}
</style>
</head>
<body>
	<div class="topFix">
		<div class="aui-tab aui-border-b" id="type-tab">
				<button class="aui-tab-item bt aui-active" tapmode onClick="openTeam(1);">A级团队(<span id="a">0</span>)</button>
				<button class="aui-tab-item bt " tapmode onClick="openTeam(2);">B级团队(<span id="b">0</span>)</button>
		</div>
	</div>
	<div class="black"></div>
	<div id="list_html"></div>
	<script type="text/x-dot-template" id="list_tpl">
	{{ for(var i in it) { }}
	<div class="info-list border-b comFlexItem" data-team="{{=it[i].team}}" data-type="{{=it[i].type}}">
		<div class="rsdius head"><img src="{{=it[i].user_avatar}}" class="radius" alt=""></div>
		<div class="flex-auto" >
			<div class="aui-flex-col aui-font-size-14 color-333" style="flex-direction: column" onClick="opendetial({{=it[i].num_iid}})">
			<p class="aui-font-size-12 color-ad">{{=it[i].user_nickname}}&nbsp通过{{=it[i].site_name}}购买{{=it[i].item_title}}</p>
				合计：￥{{=it[i].pay_price}}
			</div>
		</div>
	</div>
	{{}}}
	</script>
</body>
<script type="text/javascript" src="../../script/import.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
apiready = function(){
	api.parseTapmode();
	getTeamList()
};
function openTeam(ind) {
	$$('#type-tab > button').removeClass('aui-active').eq(ind -1).addClass('aui-active');
	changeTeam(ind);
}
//切换团队
function changeTeam(n){
	getTeamList(n);
}
//获取订单列表
function getTeamList(n){
		api.ajax({
		  url: BASE_URL + 'App/User/teamListorder',
			method: 'post',
			data: {
				values: {
					userid: getUserId(),
					team: 2,
				}
			}
		},function(ret, err){
			if (ret && ret.code == 1) {
				//渲染AB两队订单数
				console.log(JSON.stringify(ret));
				$$('#a').text(ret.ateam_order_count)
				$$('#b').text(ret.bteam_order_count)
				// $$('.noData').addClass('aui-hide');
				var tpl = $$('#list_tpl').html();
				var tempFn = doT.template(tpl);
				$$('#list_html').html(tempFn(ret.ateam_order));
				if(n == 2){
					$$('#list_html').html(tempFn(ret.bteam_order));
				}
				// api.parseTapmode();
			}else{
				$$('#list_html').html('');
				toast('请登陆')
				// $$('.noData').removeClass('aui-hide');
			}
		});
}

//打开商品详情
function opendetial(numiid){
	//获取shop_id
	api.ajax({
	    url: BASE_URL + 'App/select/getshopid',
	    method: 'post',
	    data: {
	        values: {
	            num_iid: numiid
	        },
	    }
	},function(ret, err){
	    if (ret) {
				openProductDetail(ret.shop_id)
	        // alert( JSON.stringify( ret ) );
	    } else {
	        toast('该商品已经被删除')
	    }
	});


}
</script>
</html>
